package com.demo03;

import org.junit.Test;

public class client {
    @Test
    public void test() {
        // 真实角色
        Host host = new Host();
        // 代理实例的调用程序
        ProxyInvocationHandler proxyInvocationHandler = new ProxyInvocationHandler();
        // 将真实角色放进去
        proxyInvocationHandler.setRent(host);
        // 动态生成对应的代理类
        Rent proxy = (Rent) proxyInvocationHandler.getProxy();
        proxy.rent();
    }
}
